package demo1;

public class Login {
    private String userName = "zhangsan";
    private String password = "123456";

    public void loginInfo(String userName, String password) {
        if (!this.userName.equals(userName)) {
            throw new UserNameException("用户名输入错误!");
        }
        if (!this.password.equals(password)) {
           throw new PassWordException("密码输入错误!");
        }
        System.out.println("登陆成功");
    }
    public static void main(String[] args) {
        Login login = new Login();
        login.loginInfo("zhangsan", "123456");
    }
}
